< previous page page_666 next page >

Page 666
You can use this equation to determine whether two vectors are perpendicular, point in more or less the same direction, or point in opposite directions.
< 0
Cos(q) < 0, so the vectors point in more or less opposite directions.
A B
= 0
Cos(q) = 0, so the vectors are perpendicular.
> 0
Cos(q) > 0, so the vectors point in more or less the same direction.

If two vectors are parallel, the angle between them is zero, so:
e10a6a0a59f035e870d90cca05b85fce.gif
A  B = |A| * |B| * Cos(0)
      = |A| * |B|
Projection of a Vector Onto a Vector
You can use the dot product to find the projection of one vector onto another. Figure 19.3 shows the projection A' of the vector A onto the vector B. The definition of the cosine says:
e10a6a0a59f035e870d90cca05b85fce.gif
Cos(q) = |A'|/|A|
Solving for |A'| and replacing the cosine with the dot product gives:
e10a6a0a59f035e870d90cca05b85fce.gif
|A'| = |A| * ((A · B)/(|A| * |B|))
     = (A  B)/|B|
The projection of A onto B is a vector in the same direction as B but that has the length (A B)/|B|. To find this vector, divide B by its length and then multiply by the desired length |A'|. This gives:
e10a6a0a59f035e870d90cca05b85fce.gif
(B/|B|) * ((A  B)/|B|) = B * (A  B)/|B|2
For example, suppose A = <1, 1> and B = <3, 0> as shown in Figure 19.4. Then:
z0686-01.gif
Figure 19.3
Projecting the vector A onto the vector B.

 
< previous page page_666 next page >